<html>
<head><meta charset="utf-8"><title>No compression of bytecode? · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html">No compression of bytecode?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="181253696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181253696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181253696">(Nov 20 2019 at 21:52)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> A while back I think you said you could be ok with bytecode not being compressed? I've been experimenting with that, it reduces compile time by up to 5% on debug builds.</p>



<a name="181253714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181253714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181253714">(Nov 20 2019 at 21:52)</a>:</h4>
<p>I need to measure the impact on the .rlib file sizes.</p>



<a name="181254754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181254754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181254754">(Nov 20 2019 at 22:02)</a>:</h4>
<p>Nice!</p>



<a name="181254759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181254759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181254759">(Nov 20 2019 at 22:02)</a>:</h4>
<p>I'd personally be totally fine decompressing the bytecode</p>



<a name="181254768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181254768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181254768">(Nov 20 2019 at 22:02)</a>:</h4>
<p>and/or investigating faster compression algorithms</p>



<a name="181254803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181254803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181254803">(Nov 20 2019 at 22:02)</a>:</h4>
<p>something like a lower compression level or maybe even zstd might get 90% of the wins</p>



<a name="181254814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181254814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181254814">(Nov 20 2019 at 22:03)</a>:</h4>
<p>I'd be fine removing the compression entirely myself</p>



<a name="181255047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181255047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181255047">(Nov 20 2019 at 22:06)</a>:</h4>
<p>it is worth noting that a common complaint is that Rust produces enormous target directories</p>



<a name="181255087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181255087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181255087">(Nov 20 2019 at 22:07)</a>:</h4>
<p>Though I personally think the solution there is not compression but rather storing different data (and/or "intelligent" compression) -- I am also unopposed to not compressing</p>



<a name="181255103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181255103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181255103">(Nov 20 2019 at 22:07)</a>:</h4>
<p>it may also be plausible that we can easily compress on a separate thread?</p>



<a name="181257656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181257656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181257656">(Nov 20 2019 at 22:39)</a>:</h4>
<p>We already use "Fast" compression (as opposed to "Best", "Default", or "None")</p>



<a name="181258168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181258168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181258168">(Nov 20 2019 at 22:47)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> there are mentions of "bitcode" and "bytecode". Are these the same thing?</p>



<a name="181259198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259198">(Nov 20 2019 at 23:01)</a>:</h4>
<p>Hmm, a rough comparison on one project suggests that disabling compression increases .rlib file size by typically 10-25%</p>



<a name="181259273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259273">(Nov 20 2019 at 23:02)</a>:</h4>
<p>Given that they are regular 1MiB+, I'm reluctant to cause that much disk usage increase</p>



<a name="181259722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259722">(Nov 20 2019 at 23:08)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@nnethercote</span> I think bitcode and bytecode are the same</p>



<a name="181259729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259729">(Nov 20 2019 at 23:08)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@nnethercote</span> honestly actually I think there's a better solution here, albeit more involved</p>



<a name="181259739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259739">(Nov 20 2019 at 23:08)</a>:</h4>
<p>the only purpose of bytecode in rlibs is for LTO</p>



<a name="181259744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259744">(Nov 20 2019 at 23:09)</a>:</h4>
<p>but most projects don't use LTO</p>



<a name="181259756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259756">(Nov 20 2019 at 23:09)</a>:</h4>
<p>actually, so here's a real kicker</p>



<a name="181259760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259760">(Nov 20 2019 at 23:09)</a>:</h4>
<p>ok so ignore libstd</p>



<a name="181259766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259766">(Nov 20 2019 at 23:09)</a>:</h4>
<p><em>if</em> you execute LTO</p>



<a name="181259780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259780">(Nov 20 2019 at 23:09)</a>:</h4>
<p>then you do a huge amount of object file codegen in the middle, none of which is used, all of which is wasted time</p>



<a name="181259790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259790">(Nov 20 2019 at 23:09)</a>:</h4>
<p>(For this whole project (<a href="https://github.com/mozilla/fix-stacks" target="_blank" title="https://github.com/mozilla/fix-stacks">https://github.com/mozilla/fix-stacks</a>) the rlibs total size goes from 276,561,064 to 347,907,278, a 1.26x increase)</p>



<a name="181259791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259791">(Nov 20 2019 at 23:09)</a>:</h4>
<p><em>if you dont' do LTO</em> then you're creating a bunch of bitcode that's never used</p>



<a name="181259856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259856">(Nov 20 2019 at 23:10)</a>:</h4>
<p>so the real solution here is to probably add two flags to the compiler which Cargo automatically passes:</p>
<ul>
<li>One flag disables embedding bitcode in an rlib</li>
<li>Another flag disables objects in an rlib</li>
</ul>



<a name="181259871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259871">(Nov 20 2019 at 23:10)</a>:</h4>
<p>That's both compile time wins and disk space wins all across the board</p>



<a name="181259882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259882">(Nov 20 2019 at 23:10)</a>:</h4>
<p>and everything will be turned on by default as soon as we land it in cargo</p>



<a name="181259887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259887">(Nov 20 2019 at 23:10)</a>:</h4>
<p>does that make sense?</p>



<a name="181259931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259931">(Nov 20 2019 at 23:12)</a>:</h4>
<p>So when would bitcode be omitted, and when would the object be omitted?</p>



<a name="181259978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259978">(Nov 20 2019 at 23:12)</a>:</h4>
<p>if you compile with LTO, there's no need to put object files in rlibs</p>



<a name="181259988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259988">(Nov 20 2019 at 23:12)</a>:</h4>
<p>(nor is there any reason to compress the bitcode found in the rlib)</p>



<a name="181259997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259997">(Nov 20 2019 at 23:12)</a>:</h4>
<p>we have a flag like that with <code>-C</code> for cross-lang LTO, but rust projects should be using that as well</p>



<a name="181259999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181259999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181259999">(Nov 20 2019 at 23:12)</a>:</h4>
<p>ok, so the rlib should contain: object XOR bitcode</p>



<a name="181260001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260001">(Nov 20 2019 at 23:12)</a>:</h4>
<p>?</p>



<a name="181260015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260015">(Nov 20 2019 at 23:13)</a>:</h4>
<p>correct</p>



<a name="181260018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260018">(Nov 20 2019 at 23:13)</a>:</h4>
<p>except for libstd, but ignore that</p>



<a name="181260030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260030">(Nov 20 2019 at 23:13)</a>:</h4>
<p>sounds great!</p>



<a name="181260032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260032">(Nov 20 2019 at 23:13)</a>:</h4>
<p>for everything cargo produces locally it should be xor</p>



<a name="181260049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260049">(Nov 20 2019 at 23:13)</a>:</h4>
<p>so we either (a) don't produce any bitcode, nor compress it, or (b) don't codegen something that's not needed</p>



<a name="181260055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260055">(Nov 20 2019 at 23:13)</a>:</h4>
<p>both of which can be pretty significant savings</p>



<a name="181260118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260118">(Nov 20 2019 at 23:14)</a>:</h4>
<p>Definitely</p>



<a name="181260127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260127">(Nov 20 2019 at 23:14)</a>:</h4>
<p>It seems that uncompressed bitcode/bytecode is also a thing: <a href="https://github.com/rust-lang/rust/blob/6576f4be5af31a5e61dfc0cf50b7130e6c6dfb35/src/librustc/dep_graph/graph.rs#L910-L914" target="_blank" title="https://github.com/rust-lang/rust/blob/6576f4be5af31a5e61dfc0cf50b7130e6c6dfb35/src/librustc/dep_graph/graph.rs#L910-L914">https://github.com/rust-lang/rust/blob/6576f4be5af31a5e61dfc0cf50b7130e6c6dfb35/src/librustc/dep_graph/graph.rs#L910-L914</a></p>



<a name="181260159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260159">(Nov 20 2019 at 23:15)</a>:</h4>
<p>yeah so <span class="user-mention" data-user-id="124287">@mw</span> might be able to help out there to explain more</p>



<a name="181260167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260167">(Nov 20 2019 at 23:15)</a>:</h4>
<p>but there's a <code>-C</code> flag which makes our rlibs "cross lang lto compatible"</p>



<a name="181260171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260171">(Nov 20 2019 at 23:15)</a>:</h4>
<p>which means that all the <code>*.o</code> files are actually uncompress bitcode</p>



<a name="181260173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260173">(Nov 20 2019 at 23:15)</a>:</h4>
<p>uncompressed*</p>



<a name="181260195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260195">(Nov 20 2019 at 23:15)</a>:</h4>
<p>note though that this is a pretty simple concept</p>



<a name="181260241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260241">(Nov 20 2019 at 23:16)</a>:</h4>
<p>but there's a fair amont of legwork to get it all hooked up in the compiler</p>



<a name="181260277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260277">(Nov 20 2019 at 23:16)</a>:</h4>
<p>for example the LTO passes in rustc need to get updated of how they look for bitcode, it's either a "libstd rlib" where it's located adjacent to the object or it's a "cargo rlib" where it's the <code>*.o</code> file</p>



<a name="181260475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181260475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181260475">(Nov 20 2019 at 23:20)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> You've lost me... is this "legwork" about the original idea (object XOR bitcode), or about the uncompressed bitcode stuff?</p>



<a name="181261576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261576">(Nov 20 2019 at 23:35)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@nnethercote</span> the xor idea</p>



<a name="181261627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261627">(Nov 20 2019 at 23:36)</a>:</h4>
<p>I suspect uncompressed bitcode is dead in the water if it inflates sizes that much</p>



<a name="181261661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261661">(Nov 20 2019 at 23:37)</a>:</h4>
<p>I agree my original idea of not compressing bitcode is not good. But 'object XOR bitcode' would make it much less interesting anyway, since only LTO builds would end up with bitcode.</p>



<a name="181261737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261737">(Nov 20 2019 at 23:38)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@nnethercote</span> so actually</p>



<a name="181261745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261745">(Nov 20 2019 at 23:38)</a>:</h4>
<p>To start I think we just need a flag to skip bitcode</p>



<a name="181261748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261748">(Nov 20 2019 at 23:38)</a>:</h4>
<p>And that's it</p>



<a name="181261753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261753">(Nov 20 2019 at 23:38)</a>:</h4>
<p>that sounds easy :)</p>



<a name="181261756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261756">(Nov 20 2019 at 23:38)</a>:</h4>
<p>The hard part later is making lto faster but that's less interesting</p>



<a name="181261764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261764">(Nov 20 2019 at 23:38)</a>:</h4>
<p>If you add that flag I can whip up a patch for cargo</p>



<a name="181261774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261774">(Nov 20 2019 at 23:39)</a>:</h4>
<p>cool, I'll poke around, try to work it out</p>



<a name="181261778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261778">(Nov 20 2019 at 23:39)</a>:</h4>
<p>thanks for the help!</p>



<a name="181261781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261781">(Nov 20 2019 at 23:39)</a>:</h4>
<p>So I'm.basically countering your uncompressed bitcode</p>



<a name="181261786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261786">(Nov 20 2019 at 23:39)</a>:</h4>
<p>With let's delete bitcode lol</p>



<a name="181261951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181261951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181261951">(Nov 20 2019 at 23:42)</a>:</h4>
<p>"make it faster" is good, but "don't do it at all" is better :)</p>



<a name="181587466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/181587466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#181587466">(Nov 21 2019 at 21:43)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/66598" target="_blank" title="https://github.com/rust-lang/rust/pull/66598">https://github.com/rust-lang/rust/pull/66598</a> is the PR, for anyone following along. Big wins!</p>



<a name="182395508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/182395508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#182395508">(Dec 02 2019 at 22:11)</a>:</h4>
<p><span class="user-mention" data-user-id="124287">@mw</span> Thanks for writing up <a href="https://github.com/rust-lang/rust/issues/66961" target="_blank" title="https://github.com/rust-lang/rust/issues/66961">#66961</a>! I'm considering adding this to my list of tasks for Q1 2020, because I suspect it won't get done otherwise. Does that sound right to you?</p>



<a name="182427627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/No%20compression%20of%20bytecode%3F/near/182427627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/No.20compression.20of.20bytecode.3F.html#182427627">(Dec 03 2019 at 09:05)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@nnethercote</span> Yes, that sounds good. I can do the reviewing then.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>